/**
 * Copyright (c) 时间, Tal.Ben 袁东昊 (ydonghao2@gmail.com).
 *
 * 版权
 */
package com.talben.soudian.fragment.viewpagerfragment;

import android.view.View;

import com.talben.soudian.R;
import com.talben.soudian.adapter.ViewPageFragmentAdapter;
import com.talben.soudian.base.BaseFragment;
import com.talben.soudian.base.BaseViewPagerFragment;
import com.talben.soudian.fragment.GameFragment;
import com.talben.soudian.fragment.VideoFragment;

/**
 * @Title: NetworkViewPagerFragment.java
 * @Package com.talben.soudian.fragment.viewpagerfragment
 * @Description: TODO(添加描述)
 * @author Tal.Ben
 * @date 2015年6月21日 上午6:51:10
 * @version v1.0
 */
public class NetworkViewPagerFragment extends BaseViewPagerFragment{

	public static NetworkViewPagerFragment newInstance(int position) {
		return new NetworkViewPagerFragment();
	}
	
	@Override
	protected void onSetupTabAdapter(ViewPageFragmentAdapter adapter) {
		String[] title = getResources().getStringArray(
				R.array.network_viewpage_arrays);
		adapter.addTab(title[0], "game_catalog",
				GameFragment.class, null);
		adapter.addTab(title[1], "vedio_catalog",
				VideoFragment.class, null);
	}

	@Override
	public void onClick(View v) {

	}

	@Override
	public void initView(View view) {

	}

	@Override
	public void initData() {

	}

	@Override
	public boolean onBackPressed() {
		BaseFragment fragment = (BaseFragment) mTabsAdapter.getItem(mViewPager
				.getCurrentItem());
		if (fragment instanceof GameFragment) {
			return fragment.onBackPressed();
		}
		if (fragment instanceof VideoFragment) {
			return fragment.onBackPressed();
		}
		return super.onBackPressed();
	}
}

